<?php

namespace App\Http\Controllers\web;

use App\Http\Controllers\Controller;
use App\Repository\RepositoryInterface\ShopInterface;
use Illuminate\Http\Request;
//商户类
class ShopController extends Controller
{
    //
    protected $shop;

    public function __construct(ShopInterface $shop){
        $this->shop = $shop;
    }
    /**
     * @return mixed
     * 查询所有评论
     */
    public function shopRemarkAll()
    {
        //查询所有评论
        return $this->shop->shopRemarkAll();
    }

    /**
     * @return mixed
     * 删除评论
     */
    public function shopRemarkDel(){
        //接受id
        $id = \request()->get('id');
        //删除
        return $this->shop->shopRemarkDel($id);
    }
    /**
     * @return mixed
     * 热卖商品推荐
     */
    protected function recommendShop()
    {
        return $this->shop->recommendShop();
    }
    protected function manhattans(){
        //接受id
        $uid = \request()->get('uid');
        //推荐算法
        return $this->shop->manhattans($uid);
    }
    /**
     * @return mixed
     * 评论回复
     */
    public function reply()
    {
        //获取数据
        $id = \request()->post('id');
        $mark = \request()->post('mark');
        //回复
        return $this->shop->reply($id,$mark);
    }
    /**
     * @return mixed
     * 添加评论
     */
    public function shopRemarkAdd()
    {
        //获取数据
        $addData = \request()->post();
        //回调数据
        return $this->shop->shopRemarkAdd($addData);
    }
    /**
     * @return mixed
     * 七牛云上传
     */
    public function remarkImageUpload()
    {
        //获取数据
        $file = \request()->file('file');
        //上传图片
        return $this->shop->remarkImageUpload($file);
    }
    /**
     * @return mixed
     * 搜索评论
     */
    public function shopRemarkSearch()
    {
        //获取数据
        $searchData = \request()->post();
        //回调数据
        return $this->shop->shopRemarkSearch($searchData);
    }

}
